#include<stdio.h>
#include<string.h>
struct Employee
{
    int num;
    char name[20];
    float salary;
};
int main(void)
{
    struct Employee employee[20],temp;
    int i,n,j,index;
    float sum;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d%s%f",&employee[i].num,employee[i].name,&employee[i].salary);
    }
   	for(i=0;i<n-1;i++)
   	{
   		index=i;
   		for(j=i+1;j<n;j++)
   		{
   			if(employee[j].salary>employee[index].salary)
   			{
   				index=j;
   			}
			
   		}
   		temp=employee[index];
   		employee[index]=employee[i];
   		employee[i]=temp;
   	}
    for(i=0;i<n;i++)
    {
    	printf("%d %s %.2f\n",employee[i].num,employee[i].name,employee[i].salary);
    }
    return 0;
}
